package StudyCode.Collections;

import java.util.PriorityQueue;

/**
 * @author lixiaoyao
 */
public class PriorityQueueTest {

	public static void main(String[] args) {
		PriorityQueue<String> pq = new PriorityQueue<>();
		pq.add("t");
		pq.add("a");
		pq.add("s");
		pq.add("b");

		System.out.println("Iterating over elements...");
		for (String str : pq) {
			System.out.println(str);
		}

		System.out.println("Removing elements...");
		while (!pq.isEmpty()) {
			System.out.println(pq.remove());
		}

	}

}
